<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html>
<head>
<meta charset="utf-8">
<title><?php echo SEO('article-add','title');?></title>
<meta name="keywords" content="<?php echo SEO('article-add','keywords');?>">
<meta name="description" content="<?php echo SEO('article-add','description');?>">
<link href="/<?php echo C('UU_TPL_DIR');?>/public/css/article.css"     rel="stylesheet" type="text/css">
<link rel="shortcut icon" href="/favicon.ico" />
<link href="/<?php echo C('UU_TPL_DIR');?>/public/css/common.css" rel="stylesheet" type="text/css">
<script src="/<?php echo C('UU_TPL_DIR');?>/public/js/jquery.min.js"></script>
<script src="/<?php echo C('UU_TPL_DIR');?>/public/js/jquery.dialog.js"></script>
<script src="/<?php echo C('UU_TPL_DIR');?>/public/js/common.js"></script>
<script src="/<?php echo C('UU_TPL_DIR');?>/public/js/jquery.disappear.tooltip.js"></script>
<!--[if lt IE 9]>
  <script type="text/javascript" src="/<?php echo C('UU_TPL_DIR');?>/public/js/PIE.js"></script>
  <script type="text/javascript">
    (function($){
        $.pie = function(name, v){
            // 如果没有加载 PIE 则直接终止
            if (! PIE) return false;
            // 是否 jQuery 对象或者选择器名称
            var obj = typeof name == 'object' ? name : $(name);
            // 指定运行插件的 IE 浏览器版本
            var version = 9;
            // 未指定则默认使用 ie10 以下全兼容模式
            if (typeof v != 'number' && v < 9) {
                version = v;
            }
            // 可对指定的多个 jQuery 对象进行样式兼容
            if ($.browser.msie && obj.size() > 0) {
                if ($.browser.version*1 <= version*1) {
                    obj.each(function(){
                        PIE.attach(this);
                    });
                }
            }
        }
    })(jQuery);
    if ($.browser.msie) {
      $.pie('.pie_about');
    };
  </script>
<![endif]-->
<script type="text/javascript">
var ajaxURL="<?php echo RU('ajax/view');?>";
</script>
</head>

<body>

<div class="pagetop">
		<div class="main">
          <div class="welcome link_orange" id="J_welcome">欢迎登录 <?php echo C('UU_SITE_NAME');?>！请 <span><a href="Javascript: void(0)" class="J_user_login">登录</a></span>或<span><a href="Javascript: void(0)" class="J_user_reg">注册</a></span></div>
          <div class="menu link_gray6"><a href="<?php echo C('UU_SITE_DOMAIN');?>/" class="home">网站首页</a>
		  
		  <!-- <a href="#" class="ranking">排行榜</a> <a href="#" class="category">问题分类</a> <a href="#" class="mall">积分商城</a> -->
		   
		   </div>
        	<div class="clear"></div>
        </div>
</div>

<div class="header">
  <div class="logo"><a href="/"><img src="http://www.zgxmall.com/data/upload/mall/common/05999185122820637.png"  alt="<?php echo C('UU_SITE_NAME');?>" border="0"/></a></div>
  <div class="so"></div>
  <div class="clear"></div>
</div>

<div class="pagenav">
  <div class="navmain link_white">
  <?php $tag_nav_class = new \Common\Taglib\nav();$nav = $tag_nav_class->run(array('listname'=>'nav','cache'=>'0',)); ?>
			<?php if(is_array($nav)): $i = 0; $__LIST__ = $nav;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$nav): $mod = ($i % 2 );++$i;?><div class="li  <?php if($page_as == $nav['pagealias']): ?>select<?php endif; ?>"><a href="<?php echo ($nav["url"]); ?>" target="<?php echo ($nav["target"]); ?>"><?php echo ($nav["title"]); ?></a></div><?php endforeach; endif; else: echo "" ;endif; ?>
    <div class="clear"></div>
  </div>
</div>


 


  <div class="article_add">
  
  <?php if($_SESSION['uu']['uid']== ''): ?><div class="logintip">
		  		<div class="txt font_yellow">&nbsp;&nbsp;&nbsp;&nbsp;已有账号？登陆后获取特权!</div>
		  <div class="txt">
				<div class="btn_green btn_inline_small btn_border J_user_login">立刻登录</div>
		  </div>
			  <div class="txt font_gray6">用第三方账号登录</div>
			  <div class="txt">
		  			<?php if(is_array($oauth_list)): $i = 0; $__LIST__ = $oauth_list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$oauth): $mod = ($i % 2 );++$i;?><a class="uu_api_login_btn <?php echo ($key); ?>" href="<?php echo U('callback/index',array('mod'=>$key,'type'=>'login'));?>"></a><?php endforeach; endif; else: echo "" ;endif; ?>
					<div class="clear"></div>
			  </div>
		  <div class="clear"></div>
		</div><?php endif; ?>
	
	<form  name="add"  method="post" action="<?php echo RU('article/addsave');?>">
		
		<h4>文章标题</h4>
		
    <div class="inputbox zindextop">
		<input name="title" type="text" class="inputs w560"  placeholder="请在这里输入文章标题">
		
		<?php if(C('UU_CAT_LEVEL_ARTICLE') > '0'): ?><div class="categorysel J_cat_menu">选择文章分类</div>
		<input name="category1" id="J_category1" type="hidden" value="0">
		<input name="category2" id="J_category2" type="hidden" value="0">
		<div class="show_menu J_cat_show_menu">
			<ul>
				<?php $tag_cat_class = new \Common\Taglib\cat();$li = $tag_cat_class->run(array('listname'=>'li','type'=>'2','pid'=>'0','cache'=>'0',)); ?>
				<?php if(is_array($li["list"])): $i = 0; $__LIST__ = $li["list"];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$li): $mod = ($i % 2 );++$i;?><li id="<?php echo ($li["c_id"]); ?>" title="<?php echo ($li["c_title"]); ?>"><span class="liimg"><img src="/<?php echo C('UU_IMG_CATEGORY_DIR'); echo ($li["c_pic"]); ?>" /></span><?php echo ($li["c_title"]); ?></li><?php endforeach; endif; else: echo "" ;endif; ?>
			</ul>
		</div><?php endif; ?>
		
	  </div>
		
		<h4>文章正文</h4>
	<div class="inputbox">
		<textarea name="content"  id="contentqq" cols="" rows="" class="inputs h100" placeholder="请在这里输入文章正文"></textarea>
	</div>
	
		 <div class="tagdiv"> 
				   <div class="tagbox">
				     <div class="addtag" id="J_addtag">选择标签</div>
   					     <div class="tip">添加多个标签能使文章快速传播</div>
	               </div>
      </div>
	
	<div class="upimg">
	  	<div class="addimgbtn" id="J_upload_btn" name="article_img" >上传封面图片<span>(建议尺寸245*180)</span></div>
	</div>
	  
	  
	<!--最多可选择3个标签 ,未添加下方DIV默认 display:none -->
     <div class="showtag">
				<div class="tip">你还可以添加<span>3</span>个标签</div>
				<div class="clear"></div>
    </div>
 

<?php if($_SESSION['uu']['uid']== ''): ?><div class="mb">
	   <div class="mbmain"> 
	     <input type="text" class="mbiput" maxlength="11" onKeyUp="if(event.keyCode !=37 && event.keyCode != 39) value=value.replace(/\D/g,'');"onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/\D/g,''))"  placeholder="输入手机号"  name="mobile" >
	     
	     <input type="text" class="mbiput code" maxlength="11" onKeyUp="if(event.keyCode !=37 && event.keyCode != 39) value=value.replace(/\D/g,'');"onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/\D/g,''))" placeholder="输入验证码"  name="code">
		 <div class="mbiput btn" id="J_send_code">获取验证码</div>
        </div>
	 </div><?php endif; ?> 
	 
     <div class="btns">

	   <input name="" type="button" id="J_add" value="保存文章" class="btn"> 

	 
	   
	   <div class="clear"></div>
    </div>
    </form>
	 
  </div>
  
  
  
 
<div class="footernav link_gray6">
<a href="<?php echo C('UU_SITE_DOMAIN');?>/">首页</a>
<?php $tag_intro_class = new \Common\Taglib\intro();$li = $tag_intro_class->run(array('listname'=>'li','cache'=>'0',)); ?>
<?php if(is_array($li["list"])): $i = 0; $__LIST__ = $li["list"];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$li): $mod = ($i % 2 );++$i;?><span>|</span><a href="<?php echo ($li["url"]); ?>" target="_blank"><?php echo ($li["title"]); ?></a><?php endforeach; endif; else: echo "" ;endif; ?>
</div>  
<div class="footertxt link_gray3">
<a href="http://www.miibeian.gov.cn/" target="_blank"><?php echo C('UU_ICP');?></a>
Powered By <a href="http://www.zgxmall.com" target="_blank"><span class="by">中港星企业服务论坛</span><span class="version"><?php echo C('UU_VERSION');?></span></a>
<?php echo C('UU_COPYRIGHT');?>
<br />
联系地址：深圳市罗湖区人民南路国贸大厦17、19楼&nbsp;&nbsp;&nbsp;&nbsp;联系电话：0755-82211688
 
<div class="statistics"><?php echo C('UU_STATISTICS');?></div>
</div>

<script charset="utf-8" src="/<?php echo C('UU_TPL_DIR');?>/public/js/kindeditor/kindeditor-min.js"></script>
<script charset="utf-8" src="/<?php echo C('UU_TPL_DIR');?>/public/js/kindeditor/lang/zh_CN.js"></script>
<script type="text/javascript">
KindEditor.ready(function(K) {
				K.each({
					'plug-align' : {
						name : '对齐方式',
						method : {
							'justifyleft' : '左对齐',
							'justifycenter' : '居中对齐',
							'justifyright' : '右对齐'
						}
					},
					'plug-order' : {
						name : '编号',
						method : {
							'insertorderedlist' : '数字编号',
							'insertunorderedlist' : '项目编号'
						}
					},
					'plug-indent' : {
						name : '缩进',
						method : {
							'indent' : '向右缩进',
							'outdent' : '向左缩进'
						}
					}
				},function( pluginName, pluginData ){
					var lang = {};
					lang[pluginName] = pluginData.name;
					KindEditor.lang( lang );
					KindEditor.plugin( pluginName, function(K) {
						var self = this;
						self.clickToolbar( pluginName, function() {
							var menu = self.createMenu({
									name : pluginName,
									width : pluginData.width || 100
								});
							K.each( pluginData.method, function( i, v ){
								menu.addItem({
									title : v,
									checked : false,
									iconClass : pluginName+'-'+i,
									click : function() {
										self.exec(i).hideMenu();
									}
								});
							})
						});
					});
				});
				K.create('#contentqq', {
				    uploadJson : "<?php echo RU('upload/img',array('type'=>'kindeditor_img'));?>",
					filePostName : 'kindeditor_img',
					themeType : 'qq',
					items : [
						'bold','italic','underline','fontname','fontsize','forecolor','hilitecolor','plug-align','plug-order','plug-indent','link'
					,'image'],
					afterBlur:function(){this.sync();} 
				});
			});
		</script>

<!--未登录发布问题 -->
<script type="text/javascript">
$(document).ready(function()
{
        //提交问题  
        $("#J_add").click(function(){
			$(this).val('正在提交......').attr("disabled","disabled");
            title=$('input[name=title]').val();
			content=$('textarea[name=content]').val();
			if (title==''){
				disapperTooltip("remind", "请填写文章标题");
				$(this).val('保存文章').removeAttr("disabled");
				 return false;
			}
			else if (title.length < 5) {
          		 disapperTooltip("remind", "您的文章标题太短了！");
				 $(this).val('保存文章').removeAttr("disabled");
           		 return false;
        	}
			if (content==''){
				disapperTooltip("remind", "请填写文章内容");
				$(this).val('保存文章').removeAttr("disabled");
			 return false;
			}
			<?php if(C('UU_CAT_LEVEL_ARTICLE') > '0'): ?>category1=$('input[name=category1]').val();
			if (category1=='0' || category1==''){
				disapperTooltip("remind", "请选择分类！");
				$(this).val('保存文章').removeAttr("disabled");
				 return false;
			}<?php endif; ?>
			<?php if($_SESSION['uu']['uid']== ''): ?>code=$('input[name=code]').val();
			if (code==''){
				disapperTooltip("remind", "请填写短信验证码！");
				$(this).val('保存文章').removeAttr("disabled");
				 return false;
			}else{
					$.getJSON(ajaxURL, { act: "ajax_mobile_code_verify",code:code}, function(json){
						if (json.status==0){
							disapperTooltip("remind",json.content);
							$("#J_add").val('保存文章').removeAttr("disabled");
							return false;
						}else if (json.status==1){
							$("form[name=add]").submit();
						}else{
							disapperTooltip("remind","未知错误");
							$("#J_add").val('保存文章').removeAttr("disabled");
							return false;
						}
					});
			}
			<?php else: ?>
			$("form[name=add]").submit();<?php endif; ?>
			
        });
		//发送验证码
		$("#J_send_code").click(function(){
					btn=$(this);
					if (btn.hasClass('btn_disabled')) return false;
					function settime(countdown) {
						if (countdown == 0) {
							$('#J_send_code').removeClass('btn_disabled');
							$('#J_send_code').text('获取验证码');
							countdown = <?php echo C('UU_SMS_SETTIME');?>;
							return;
						} else {
							$('#J_send_code').addClass('btn_disabled');
							$('#J_send_code').text('重新发送' + countdown + '秒');
							countdown--;
						}
						setTimeout(function() {
							settime(countdown)
						},1000)
					}
					var mobile=$('input[name=mobile]').val();
					if (mobile.length!=11){
						disapperTooltip("remind",'请填写正确的手机号');
						return false;
					}
					btn.addClass('btn_disabled').html('正在发送中.');
					$.getJSON(ajaxURL, { act:"ajax_send_mobile_code",mobile:mobile,in_user:0}, function(json){
						if (json.status==0){
							btn.removeClass('btn_disabled').html('获取验证码');
							disapperTooltip("remind",json.content);
						}else if (json.status==1){
							disapperTooltip("success",json.content);
							settime(<?php echo C('UU_SMS_SETTIME');?>);
						}else{
							btn.removeClass('btn_disabled').html('获取验证码');
							disapperTooltip("remind",json.content);
						}
					});
		});
});
</script>
<script type="text/javascript">
	var uploadUrl = "<?php echo RU('Upload/img');?>";
</script>
<script src="/<?php echo C('UU_TPL_DIR');?>/public/js/ajaxfileupload.js"></script>
<script src="/<?php echo C('UU_TPL_DIR');?>/public/js/fileupload.js"></script>
<script src="/data/cache_cat.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
// 上传图标
$.upload('#J_upload_btn',{type:'article_img'},function(result){
		if(result.status == 1){;
			html=htmlSTR(); 
			$(".upimg").prepend(html).show();
			var imgobj=".input_up_img ";
			$(imgobj).find('a').attr('href',result.content.src);
			$(imgobj).find('img').attr('src',result.content.src);
			$(imgobj).find('input').val(result.content.savename);
			$('.addimgbtn').hide();
		} else {
			disapperTooltip("remind", "上传失败："+result.content);
		}
		//生成html
		function htmlSTR(){
			html="";  
			html+="<div class=\"input_up_img\">";
			html+="<a href=\"#\" target=\"_blank\"><input name=\"img\" type=\"hidden\" value=\"#\"><img src=\"#\" border=\"0\" /></a>";
			html+="<div class=\"del J_img_del\">删除</div>";
			html+="</div>";
			return html;
		}
		
	});
	//删除上传图片
	$('.J_img_del').live('click',function() {
	 	$(this).parent(".input_up_img").remove();
		$(".addimgbtn").show();
	});
	//一二级分类切换
	<?php if(C('UU_CAT_LEVEL_ARTICLE') == '1'): ?>ShowMenu('.J_cat_menu','#J_category1','.J_cat_menu','.J_cat_show_menu');
	<?php else: ?>
	
	//二级分类
	$('.J_cat_menu').live('click',function() {
		 var UUDialog = $(this).dialog({
		        title: false,
        		loading: true,
				footer: false,
				header: false,
				border: false,
				backdrop: false
		});
		 $.getJSON(ajaxURL, { act: "ajax_cat_list",type:2}, function(json){
					if (json.status==0){
						UUDialog.hide();
						disapperTooltip("remind", json.content);
					}else if (json.status==1){
						UUDialog.hide();
						var MDialog = $(this).dialog({
								title: "请选择分类",
								content:json.content,
								footer: true,
								header: true,
								border: true,
								innerPadding: true,
								backdrop: true,
						 		yes: function() {
									cbtn=$(".ajax_cat_list span.select");
									ctit=cbtn.attr('title');
									category1=cbtn.attr('category1');
									category2=cbtn.attr('category2');
									if (ctit!='')
									{
										$('.J_cat_menu').text(ctit);
										$('#J_category1').val(category1);
										$('#J_category2').val(category2);
										$('.modal').remove();
										$('.modal_backdrop').remove();
									}
								 
							}
						});
						MDialog.setCloseDialog(false);
					}else{
						UUDialog.hide();
						disapperTooltip("remind","未知错误");
					}
		});
	});<?php endif; ?>
	

});
</script>
<script type="text/javascript">
$(document).ready(function()
{
//打开添加标签页JS操作 (ajax_tag_list.html页面操作)
TAGnum=3;//允许TAG添加数量

//打开标签弹窗
$('#J_addtag').live('click',function() {
		 var UUDialog = $(this).dialog({
		        title: false,
        		loading: true,
				footer: false,
				header: false,
				border: false,
				backdrop: false
		});
		
		tags=$(".showtag .tag");
		tags_str='';
		if (tags.length>0)
		{
			tags_arr=new Array();
			tags.each(function(i){
			tags_arr[i]=$(this).attr('title');
			});
			tags_str=tags_arr.join("__uuask__");
		}
		 $.getJSON(ajaxURL, { act: "ajax_tag_list",tags:tags_str}, function(json){
					if (json.status==0){
						UUDialog.hide();
						disapperTooltip("remind", json.content);
					}else if (json.status==1){
						UUDialog.hide();
						var MDialog = $(this).dialog({
								title: "请选择标签",
								content:json.content,
								footer: true,
								header: true,
								border: true,
								innerPadding: true,
								backdrop: true,
						 		yes: function() {
									tags=$(".ajax_tag_list .tagli.select");
									if (tags.length>0)
									{
										html='';
										tags.each(function(i){
										html+='<div class="tag" title="'+$(this).attr('title')+'">'+$(this).attr('title')+'<input name="tag[]" type="hidden" value="'+$(this).attr('title')+'"></div>';
										});
										$('.showtag .tag').remove();
										$('.showtag').prepend(html).show();
										unm=TAGnum-tags.length;
										$('.showtag .tip span').html(unm);
									}
								 
							}
						});
					}else{
						UUDialog.hide();
						disapperTooltip("remind","未知错误");
					}
		});
	});
//从窗口选择标签
$('.ajax_tag_list .tagli').live('click',function()
{
	if ($(this).hasClass('select')){
	$(this).removeClass('select');
	}else{
	$(this).addClass('select');
	}
	if ($(".ajax_tag_list .tagli.select").length>TAGnum){
	disapperTooltip("remind","最多只能选择"+TAGnum+"个标签");
	$(this).removeClass('select');
	}
});
//搜索标签
$('.J_sotag_btn').live('click',function()
{
	btn=$(this);
	btn.attr("disabled","disabled").addClass('btn_disabled');
	tagkey=$('#J_tagkey').val();
	if (tagkey.length==0)
	{
		disapperTooltip("remind","请填写关键字！");
		btn.removeAttr("disabled").removeClass('btn_disabled');
		return false;
	}
	$.getJSON(ajaxURL,{act: "ajax_tag_so",tagkey:tagkey}, function(json){
					
					if (json.status==0)
					{
						disapperTooltip("remind", json.content);
						btn.removeAttr("disabled").removeClass('btn_disabled');
					}
					else if (json.status==1)
					{
							if (json.count==0)
							{
								$('.ajax_tag_list .soshow').hide();
								$('.ajax_tag_list .soempty').show();
								$(".ajax_tag_list .soempty strong").html(json.key);
								$(".ajax_tag_list .soempty .J_add_tag_key").attr('title',json.key);
							}
							else
							{
								$('.ajax_tag_list .soshow').show();
								$('.ajax_tag_list .soempty').hide();
								tag=json.content;
								htm='';
								for(var i in tag)
								{
								htm+="<div class=\"tagli\" title=\""+tag[i].tag+"\">"+tag[i].tag+"</div>";
								}
								htm+="<div class=\"clear\"></div>";
								$(".ajax_tag_list .soshow .stxt").html(htm);
							}
							btn.removeAttr("disabled").removeClass('btn_disabled');
					}else{
						disapperTooltip("remind","未知错误");
						//
						btn.removeAttr("disabled").removeClass('btn_disabled');
						//
					}
	});

});
//从搜索结果添加标签
$('.J_add_tag_key').live('click',function()
{
	tag=$(this).attr('title');
	if ($(".ajax_tag_list .tagli[title='"+tag+"']").length>0)
	{
	disapperTooltip("remind",tag+"已存在，不能重复添加标签");
	return false;
	}
	else
	{
		if ($(".ajax_tag_list .tagli.select").length>=TAGnum){
		html="<div class=\"tagli\" title="+tag+">"+tag+"</div>";
		$(".ajax_tag_list .tlist .clear").before(html);
		}
		else
		{
		html="<div class=\"tagli select\" title="+tag+">"+tag+"</div>";
		$(".ajax_tag_list .tlist .clear").before(html);
		}		
	}
});
//删除所选标签
$('.showtag .tag').live('click',function()
{
	$(this).remove();
	tags=$('.showtag .tag');
	if (tags.length==0)
	{
	$('.showtag').hide();
	}
	unm=TAGnum-tags.length;
	$('.showtag .tip span').html(unm);
});
	
});
</script>
</body>
</html>